package com.bwf.bytetochar;

import javax.imageio.IIOException;
import java.io.*;
import java.util.Scanner;

/**
 * @Version v1.0
 * @Description: TODO
 * @Author ZHANZHONGXIN
 * @Date 2022/5/17 15:27
 * @Copyright 博为峰
 */
public class ByteToCharDemo {
    public static void main(String[] args) throws IOException {
//        m1();
//        m2();
        //接收用户的输入（键盘-标准输入设备），输出标准输出设备
        final PrintStream printStream = System.out;
        final BufferedReader bufferedReader = new BufferedReader(new InputStreamReader(System.in));
        while (true) {
            final String line = bufferedReader.readLine();
            printStream.println(line);
            System.out.println("abc");
        }
    }

    private static void m2() throws IOException {
        final BufferedReader bufferedReader = new BufferedReader(new InputStreamReader(System.in));
        final PrintWriter printWriter = new PrintWriter(new FileWriter("fw03.txt", true), true);
        while (true) {
            final String line = bufferedReader.readLine();
            printWriter.println(line);
        }
    }

    private static void m1() throws IOException {
        //接收用户的输入（键盘-标准输入设备），输出到文件

        //字节流对象
        InputStream in = System.in;
        //桥梁流（字符流）
        final InputStreamReader inputStreamReader = new InputStreamReader(in);
        //字符流
        final BufferedReader bufferedReader = new BufferedReader(inputStreamReader);
//--------------------------------------------------------------------------------------------------
        //字符流
        final FileWriter fileWriter = new FileWriter("fw02.txt");
        //字符流
        final BufferedWriter bufferedWriter = new BufferedWriter(fileWriter);
        while (true) {
            final String line = bufferedReader.readLine();
            bufferedWriter.write(line);
            bufferedWriter.newLine();
            bufferedWriter.flush();
        }
//        fileWriter.close();
    }
}
